Only great powers offer you alliances and pacts. Alliances are only made between great powers. Pacts, while they can be agreed to by minor nations, will never be offered by them.
When you agree to a non-aggression pact you are making a promise not to declare war on that power. This means that as long as you keep your word, you will be unable to attack that power in any way—including a case in which they attack some third nation you wish to support.
Of course, you can break the pact and declare war but the diplomatic cost of war (mainly penalties involving world opinion) are much more severe when you break a pact.
Agreeing to an Alliance is more serious. You are making a promise to declare war on any great power that declares war on your ally. The ally is making the same promise to you. Should you refuse declare war and uphold the alliance, severe diplomatic penalties apply. However, if the ally is the aggressor, not the defender, you may decide not to support the ally and suffer no penalty.